package com.rt.tmpt.controller.springmvc.admin;


import com.googlecode.genericdao.search.Search;
import com.rt.easyjava.common.base.UserDetailsDto;
import com.rt.tmpt.dto.*;
import com.rt.tmpt.service.IMenuService;
import com.rt.tmpt.service.IQuartzService;
import com.rt.tmpt.service.ISecurityV2Service;
import com.rt.tmpt.service.ITemplateService;
import com.rt.tmpt.utils.DateTool;
import com.rt.tmpt.utils.JsonMap;
import com.rt.tmpt.utils.JsonPaginationUtils;
import com.rt.tmpt.utils.StringUtils;
import com.rt.tmpt.utils.report.ExcelUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Api(tags = "模板表-控制类")
@Controller
@RequestMapping("/admin123/template")
@Slf4j
public class TemplateAction {

    @Resource
    ITemplateService templateService;
    @Resource
    ISecurityV2Service securityV2Service;
    @Resource
    IQuartzService quartzService;
    @Resource
    IMenuService menuService;

    /**
     * 分页查询列表
     *
     * @return
     */
    @GetMapping(value = "/templateAjax_queryListBySearch")
    @ResponseBody
    public Result queryListBySearch(PageDto pageDto, HttpServletRequest request) {
        Result result = new Result();
        try {
            Map<String, String[]> parameterMap = request.getParameterMap();

            //查询参数
            //分页/排序查询条件
            //默认主键desc
            if (StringUtils.isNull(pageDto.getSortColumn())) {
                pageDto.setSortColumn("id");
                pageDto.setSortOrder("desc");
            }
            pageDto.setPageCurrent(pageDto.getPageCurrent() - 1);

            result = templateService.paginationBySearch(parameterMap, pageDto);

        } catch (Exception e) {
            e.printStackTrace();
            result.fault(e.getLocalizedMessage());
        }

        return result;
    }


    /**
     * 通过模板插入记录
     *
     * @return
     */
    @PostMapping(value = "/create")
    @ResponseBody
    public Result create(String userDetailsJson, HttpServletRequest request) {
        UserDetailsDto userDetailsDto = UserDetailsDto.getUserDetailsDto(userDetailsJson);
        Result result = new Result();
        try {
            Map<String, String[]> paramMap = request.getParameterMap();
            //map to jsonstring
            String paramJson = JsonMap.map2Json(paramMap);
            String _keyRandom = request.getParameter("_keyRandom");
            //加入管理员
            org.json.JSONObject jo1 = new org.json.JSONObject(paramJson);
            jo1.put("creatorId", new String[]{userDetailsDto.getUserId()});
            jo1.put("creator", new String[]{userDetailsDto.getUserName()});
            jo1.put("companyId", new String[]{userDetailsDto.getCompanyId()});
            paramJson = jo1.toString();

            result = templateService.addData(_keyRandom, paramJson);

        } catch (Exception e) {
            e.printStackTrace();
            result.fault("error:系统出错:" + e.getLocalizedMessage());
        }
        return result;
    }

    /**
     * 通过模板插入记录
     *
     * @return
     */
    @PostMapping(value = "/update")
    @ResponseBody
    public Result update(String userDetailsJson, HttpServletRequest request) {
        UserDetailsDto userDetailsDto = UserDetailsDto.getUserDetailsDto(userDetailsJson);
        Result result = new Result();
        try {
            Map<String, String[]> paramMap = request.getParameterMap();
            //map to jsonstring
            String paramJson = JsonMap.map2Json(paramMap);
            String _keyRandom = request.getParameter("_keyRandom");
            //加入管理员
            org.json.JSONObject jo1 = new org.json.JSONObject(paramJson);
            jo1.put("creatorId", new String[]{userDetailsDto.getUserId()});
            jo1.put("creator", new String[]{userDetailsDto.getUserName()});
            jo1.put("companyId", new String[]{userDetailsDto.getCompanyId()});
            paramJson = jo1.toString();

            String id = paramMap.get("id")[0];
            result = templateService.editData(_keyRandom, id, paramJson);

        } catch (Exception e) {
            e.printStackTrace();
            result.fault("error:系统出错:" + e.getLocalizedMessage());
        }
        return result;
    }


    /**
     * 伪删除
     *
     * @return
     */
    @PostMapping(value = "/delete")
    @ResponseBody
    public Result delete(String _userName, String _keyRandom, String _id) {
        Result resultObj = new Result();
        try {
            resultObj = templateService.removeData(_keyRandom, _id, _userName);
        } catch (Exception e) {
            e.printStackTrace();
            resultObj.fault("error:系统出错:" + e.getLocalizedMessage());
        }
        return resultObj;
    }


    /**
     * 日志报表下载
     *
     * @return
     * @throws IOException
     */
    @RequestMapping(value = "/templateAjax_downloadReport")
    @ResponseBody
    public String downloadReport(
            HttpServletRequest request, HttpServletResponse response) throws IOException {
        HttpSession session = request.getSession();
        String r;
        try {
            String _keyRandom = request.getParameter("_keyRandom");
            String reportSqlString = (String) session.getAttribute(_keyRandom + "_reportSqlString");
            List<Object> paramList = (List<Object>) session.getAttribute(_keyRandom + "_reportParam");
            A1TemplateTableDto templateTable = templateService.getTemplateTable(_keyRandom);
            List<Map<String, Object>> reportList = templateService.queryReportBySearch(templateTable, reportSqlString, paramList);
            ExcelUtils.downloadReport4Template(reportList, templateTable, response);
        } catch (Exception e) {
            e.printStackTrace();
            r = "系统出错";
            JsonPaginationUtils.responseWriter(response, r);
            return null;
        }
        return null;
    }


    @RequestMapping(value = "/templateAjax_tableListBySearch")
    @ResponseBody
    public String tableListBySearch(PageDto pageDto, String recordDateStart, String recordDateEnd,
                                    HttpServletRequest request, HttpServletResponse response) {
        String r;
        try {
            Search search = new Search();
            search.setPage(pageDto.getPageCurrent() - 1);
            search.setMaxResults(pageDto.getPageSize());

            String sortOrder = pageDto.getSortOrder();
            String sortColumn = pageDto.getSortColumn();
            if ("desc".equals(sortOrder) && sortColumn != null) {
                search.addSort(sortColumn, true);
            } else if ("asc".equals(sortOrder) && sortColumn != null) {
                search.addSort(sortColumn, false);
            } else {
                search.addSort("id", false);
            }

            search.addFilterGreaterOrEqual("createDate", DateTool.string2Date(recordDateStart, "yyyy-MM-dd"));
            search.addFilterLessOrEqual("createDate", DateTool.string2DateEnd(recordDateEnd, "yyyy-MM-dd"));

            if (JsonPaginationUtils.checkDateResponseWriter(recordDateStart, recordDateEnd, response)) {
                return null;
            }

            PaginationDto<A1TemplateTableDto> pagination = templateService.paginationA1TemplateTableListBySearch(search);

            r = JsonPaginationUtils.paginationToJson(pagination);
            JsonPaginationUtils.responseWriter(response, r);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @ApiOperation("添加模板表（JPA）")
    @PostMapping(value = "/templateAjax_addA1TemplateTable")
    @ResponseBody
    public Result addA1TemplateTable(@RequestBody A1TemplateTableDto a1TemplateTableDto, String _userName) {
        Result resultObj = new Result();
        try {
            a1TemplateTableDto.setCreateMan(_userName);
            a1TemplateTableDto.setCreateDate(DateTool.getCurTimestamp());
            resultObj = templateService.addA1TemplateTable(a1TemplateTableDto);
        } catch (Exception e) {
            e.printStackTrace();
            resultObj.fault("操作失败：" + e.getLocalizedMessage());
        }
        return resultObj;
    }


    @RequestMapping(value = "/templateAjax_tableColumnListBySearch", produces = "application/json; charset=utf-8")
    @ResponseBody
    public String tableColumnListBySearch(PageDto pageDto, String a1TemplateTableId, String recordDateStart, String recordDateEnd,
                                          HttpServletRequest request, HttpServletResponse response) {
        String r;
        try {
            Search search = new Search();
            search.setPage(pageDto.getPageCurrent() - 1);
            search.setMaxResults(pageDto.getPageSize());

            String sortOrder = pageDto.getSortOrder();
            String sortColumn = pageDto.getSortColumn();
            if ("desc".equals(sortOrder) && sortColumn != null) {
                search.addSort(sortColumn, true);
            } else if ("asc".equals(sortOrder) && sortColumn != null) {
                search.addSort(sortColumn, false);
            } else {
                search.addSort("id", false);
            }

            search.addFilterEqual("a1TemplateTable.id", a1TemplateTableId);
            search.addFilterGreaterOrEqual("createDate", DateTool.string2Date(recordDateStart, "yyyy-MM-dd"));
            search.addFilterLessOrEqual("createDate", DateTool.string2DateEnd(recordDateEnd, "yyyy-MM-dd"));

            if (JsonPaginationUtils.checkDateResponseWriter(recordDateStart, recordDateEnd, response)) {
                return null;
            }

            PaginationDto<A1TemplateColumnDto> pagination = templateService.paginationA1TemplateColumnListBySearch(search);

            r = JsonPaginationUtils.paginationToJson(pagination);
            JsonPaginationUtils.responseWriter(response, r);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @RequestMapping(value = "/templateAjax_addA1TemplateColume")
    @ResponseBody
    public Result addA1TemplateColume(A1TemplateColumnDto a1TemplateColumnDto, Long a1TemplateTableId,
                                      HttpServletRequest request, HttpServletResponse response) {
        Result result = new Result();
        String r;
        try {
			/*A1TemplateColumnDto dto = new A1TemplateColumnDto();
			dto.setColumnName(columnName);
			dto.setColumnShowName(columnShowName);
			dto.setColumnNameSql(columnNameSql);
			dto.setColumnNameSqlSum(columnNameSqlSum);
			dto.setIsFrozenColumn(isFrozenColumn);
			dto.setNeedSum(needSum);
			dto.setSort(sort);
			dto.setIsHidden(isHidden);*/

            result = templateService.addA1TemplateColumn2Table(a1TemplateColumnDto, a1TemplateTableId);
            //JSONObject jo = JSONObject.fromObject(result.getMap());
            //this.result = jo.toString();
        } catch (Exception e) {
            e.printStackTrace();
            r = "操作失败：" + e.getLocalizedMessage();
            result.fault(r);
        }
        return result;
    }
/*

	@RequestMapping(value = "/templateAjax_addA1TemplateCondition")
	@ResponseBody
	public Result addA1TemplateCondition(A1TemplateConditionDto a1TemplateConditionDto, Long a1TemplateTableId,
                                         HttpServletRequest request, HttpServletResponse response){
		Result result = new Result();
		String r;
		try {
			*/
/*A1TemplateConditionDto dto = new A1TemplateConditionDto();
			dto.setColumnName(columnName);
			dto.setColumnShowName(columnShowName);
			dto.setIsMultiQuery(isMultiQuery);*//*

			result = templateService.addA1TemplateCondition2Table(a1TemplateConditionDto, a1TemplateTableId);
			*/
/*JSONObject jo = JSONObject.fromObject(result.getMap());
	    	this.result = jo.toString();*//*

		}catch (Exception e) {
			e.printStackTrace();
			r = "操作失败："+e.getLocalizedMessage();
			result.fault(r);
    		//this.result = JSONObject.fromObject(result.getMap()).toString();
		}
		return result;
	}

	@RequestMapping(value = "/templateAjax_addA1TemplateRightMenu")
	@ResponseBody
	public Result addA1TemplateRightMenu(A1TemplateRightMenuDto a1TemplateRightMenuDto, Long a1TemplateTableId,
                                         HttpServletRequest request, HttpServletResponse response){
		Result result = new Result();
		String r;
		try {
			*/
/*A1TemplateRightMenuDto dto = new A1TemplateRightMenuDto();
			dto.setItemName(itemName);
			dto.setUrl(url);*//*

			result = templateService.addA1TemplateRightMenu2Table(a1TemplateRightMenuDto, a1TemplateTableId);
			*/
/*JSONObject jo = JSONObject.fromObject(result.getMap());
	    	this.result = jo.toString();*//*

		}catch (Exception e) {
			e.printStackTrace();
			r = "操作失败："+e.getLocalizedMessage();
			result.fault(r);
    		//this.result = JSONObject.fromObject(result.getMap()).toString();
		}
		return result;
	}

	@RequestMapping(value = "/templateAjax_addA1TemplateConditionMuiltiQuery")
	@ResponseBody
	public Result addA1TemplateConditionMuiltiQuery(A1TemplateConditionMultiQueryDto a1TemplateConditionMultiQueryDto, Long a1TemplateConditionId,
                                                    HttpServletRequest request, HttpServletResponse response){
		Result result = new Result();
		String r;
		try {
			*/
/*A1TemplateConditionMultiQueryDto dto = new A1TemplateConditionMultiQueryDto();
			dto.setKeyName(keyName);
			dto.setValueName(valueName);*//*

			result = templateService.addA1TemplateMultiQuery2Condition(a1TemplateConditionMultiQueryDto, a1TemplateConditionId);
			*/
/*JSONObject jo = JSONObject.fromObject(result.getMap());
	    	this.result = jo.toString();*//*

		}catch (Exception e) {
			e.printStackTrace();
			r = "操作失败："+e.getLocalizedMessage();
			result.fault(r);
		}
		return result;
	}


	@RequestMapping(value = "/templateAjax_tableConditionListBySearch")
	@ResponseBody
	public String tableConditionListBySearch(PageDto pageDto, Long a1TemplateTableId, String recordDateStart, String recordDateEnd,
                                             HttpServletRequest request, HttpServletResponse response){
		String r;
		try {
			Search search = new Search();
			search.setPage(pageDto.getPageCurrent() - 1);
			search.setMaxResults(pageDto.getPageSize());

			String sortOrder = pageDto.getSortOrder();
			String sortColumn = pageDto.getSortColumn();
			if("desc".equals(sortOrder) && sortColumn!=null){
				search.addSort(sortColumn, true);
			}else if("asc".equals(sortOrder) && sortColumn!=null){
				search.addSort(sortColumn, false);
			}else{
				search.addSort("id", false);
			}

			search.addFilterEqual("a1TemplateTable.id", a1TemplateTableId);
			search.addFilterGreaterOrEqual("createDate", DateTool.string2Date(recordDateStart, "yyyy-MM-dd"));
			search.addFilterLessOrEqual("createDate", DateTool.string2DateEnd(recordDateEnd, "yyyy-MM-dd"));

			if(JsonPaginationUtils.checkDateResponseWriter(recordDateStart, recordDateEnd, response)){
				return "jsonResult";
			}

			PaginationDto<A1TemplateConditionDto> pagination = templateService.paginationA1TemplateConditionListBySearch(search);

			r = JsonPaginationUtils.paginationToJson(pagination);
			JsonPaginationUtils.responseWriter(response, r);

		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@RequestMapping(value = "/templateAjax_tableConditionMultiQueryListBySearch")
	@ResponseBody
	public String tableConditionMultiQueryListBySearch(PageDto pageDto, Long a1TemplateConditionId, String recordDateStart, String recordDateEnd,
                                                       HttpServletRequest request, HttpServletResponse response){
		String r;
		try {
			Search search = new Search();
			search.setPage(pageDto.getPageCurrent() - 1);
			search.setMaxResults(pageDto.getPageSize());

			String sortOrder = pageDto.getSortOrder();
			String sortColumn = pageDto.getSortColumn();
			if("desc".equals(sortOrder) && sortColumn!=null){
				search.addSort(sortColumn, true);
			}else if("asc".equals(sortOrder) && sortColumn!=null){
				search.addSort(sortColumn, false);
			}else{
				search.addSort("id", false);
			}

			search.addFilterEqual("a1TemplateCondition.id", a1TemplateConditionId);
			search.addFilterGreaterOrEqual("createDate", DateTool.string2Date(recordDateStart, "yyyy-MM-dd"));
			search.addFilterLessOrEqual("createDate", DateTool.string2DateEnd(recordDateEnd, "yyyy-MM-dd"));

			if(JsonPaginationUtils.checkDateResponseWriter(recordDateStart, recordDateEnd, response)){
				return "jsonResult";
			}

			PaginationDto<A1TemplateConditionMultiQueryDto> pagination = templateService.paginationA1TemplateConditionMultiQueryListBySearch(search);

			r = JsonPaginationUtils.paginationToJson(pagination);
			JsonPaginationUtils.responseWriter(response, r);

		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}


	@RequestMapping(value = "/templateAjax_tableRightMenuListBySearch")
	@ResponseBody
	public String tableRightMenuListBySearch(PageDto pageDto, Long a1TemplateTableId, String recordDateStart, String recordDateEnd,
                                             HttpServletRequest request, HttpServletResponse response){
		String r;
		try {
			Search search = new Search();
			search.setPage(pageDto.getPageCurrent() - 1);
			search.setMaxResults(pageDto.getPageSize());

			String sortOrder = pageDto.getSortOrder();
			String sortColumn = pageDto.getSortColumn();
			if("desc".equals(sortOrder) && sortColumn!=null){
				search.addSort(sortColumn, true);
			}else if("asc".equals(sortOrder) && sortColumn!=null){
				search.addSort(sortColumn, false);
			}else{
				search.addSort("id", false);
			}

			search.addFilterEqual("a1TemplateTable.id", a1TemplateTableId);
			search.addFilterGreaterOrEqual("createDate", DateTool.string2Date(recordDateStart, "yyyy-MM-dd"));
			search.addFilterLessOrEqual("createDate", DateTool.string2DateEnd(recordDateEnd, "yyyy-MM-dd"));

			if(JsonPaginationUtils.checkDateResponseWriter(recordDateStart, recordDateEnd, response)){
				return "jsonResult";
			}

			PaginationDto<A1TemplateRightMenuDto> pagination = templateService.paginationA1TemplateRightMenuListBySearch(search);

			r = JsonPaginationUtils.paginationToJson(pagination);
			JsonPaginationUtils.responseWriter(response, r);

		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

*/


    @ApiOperation("自动给模板表列，加载列数据，方便配置")
    @RequestMapping(value = "/templateAjax_loadColumn")
    @ResponseBody
    public Result loadColumn(String _id) {
        Result resultObj = new Result();
        try {
            resultObj = templateService.loadColumn(_id);
        } catch (Exception e) {
            e.printStackTrace();
            resultObj.fault(e.getLocalizedMessage());
        }
        return resultObj;
    }

    @ApiOperation("自动从库加载模板By表名")
    @GetMapping(value = "/autocodebuilder")
    @ResponseBody
    public Result autocodebuilder(String mistTablename) {
        Result resultObj = new Result();
        try {
            // 通过 mist tablename 找到所有符合的表名
            resultObj = templateService.autocodebuilder(mistTablename);

            //整理页面文字描述
            StringBuffer sb = new StringBuffer();
            List<Map<String, Object>> tableList = resultObj.getList();
            sb.append("共有").append(tableList.size()).append("张表待处理；表名:");
            for (Map<String, Object> tableMap : tableList) {
                String tableName = (String) tableMap.get("tableName");
                String primaryKey = (String) tableMap.get("primaryKey");
                sb.append(tableName).append("、");
            }
            resultObj.setRemark(sb.toString());
            resultObj.success();
        } catch (Exception e) {
            e.printStackTrace();
            resultObj.fault(e.getLocalizedMessage());
        }
        return resultObj;
    }


    /**
     * 查询一级菜单：模板生成二级菜单中要查询一级菜单上交
     *
     * @return
     */
    @RequestMapping(value = "/templateAjax_queryMenu1List")
    @ResponseBody
    public Result queryMenu1List(
            HttpServletRequest request) {
        Result result = new Result();
        String r;
        try {
            Result<A2Menu1Dto> resultObj = securityV2Service.queryMenu1List();
            List<A2Menu1Dto> menu1DtoList = resultObj.getList();

            //list to jsonarray
            //List<Map<String,Object>> jsonArrayResult = new ArrayList<Map<String,Object>>();
            for (A2Menu1Dto menu1Dto : menu1DtoList) {
                Map<String, Object> jo = new HashMap<String, Object>();
                jo.put("id", menu1Dto.getId());
                jo.put("text", menu1Dto.getText());
                //jsonArrayResult.add(jo);
                result.getList().add(jo);
            }
        } catch (Exception e) {
            e.printStackTrace();
            r = "error:操作失败：" + e.getLocalizedMessage();
            result.fault(r);
        }
        //return "jsonArray";
        return result;
    }


    /**
     * 生成single chart 图表二级菜单
     * @return
     */
	/*@RequestMapping(value = "/templateAjax_template2menu4chart")
	@ResponseBody
	public Result template2menu4chart(String _id, String menu1Id, String menu2Name, String columnName,
                                      HttpServletRequest request){
		long userId = Long.parseLong(WebUtils.getUserId(request.getSession()));
		Result resultObj = new Result();
		String r;
		try {
			long _templateColumnId = Long.parseLong(_id);
			Map<String,Object> mapParam = new HashMap<String, Object>();
			mapParam.put("_templateColumnId",_templateColumnId);
			mapParam.put("menuIdParent",Long.parseLong(menu1Id));
			mapParam.put("menuName",menu2Name);
			mapParam.put("columnName",columnName);
			mapParam.put("userId",userId);
			mapParam.put("pageType","pageType");

			resultObj = menuService.template2menu4ChartSingle(mapParam);
	    	r = resultObj.getContent();
	    	r = JsonMap.map2Json(resultObj.getMap());
			//JsonPaginationUtils.responseWriter(response, this.result);
		}catch (Exception e) {
			e.printStackTrace();
			r = "error:操作失败："+e.getLocalizedMessage();
			resultObj.fault(r);
		}
		return resultObj;

	}*/


    /**
     * 启动工作任务
     * _id： a2Job_id
     *
     * @return
     */
    @RequestMapping(value = "/templateAjax_timerStartup")
    @ResponseBody
    public Result timerStartup(String _id) {
        Result resultObj = new Result();
        String r;
        try {
            // System.out.println("---------_id:"+_id);
            resultObj = quartzService.timerStartup(Long.parseLong(_id));
        } catch (Exception e) {
            e.printStackTrace();
            r = "error:操作失败：" + e.getLocalizedMessage();
            resultObj.fault(r);
        }
        return resultObj;
    }


    /**
     * start timer immediately
     *
     * @param _id
     * @return
     */
    @RequestMapping(value = "/templateAjax_timerStartupImmediately")
    @ResponseBody
    public Result timerStartupImmediately(String _id) {
        Result resultObj = new Result();
        String r;
        try {
            System.out.println("---------_id:" + _id);
            resultObj = quartzService.timerStartupImmediately(Long.parseLong(_id));
        } catch (Exception e) {
            e.printStackTrace();
            r = "error:操作失败：" + e.getLocalizedMessage();
            resultObj.fault(r);
        }
        return resultObj;
    }


    /**
     * 关闭工作任务
     *
     * @return
     */
    @RequestMapping(value = "/templateAjax_timerShutdown")
    @ResponseBody
    public Result timerShutdown(String _id) {
        Result resultObj = new Result();
        String r;
        try {
            resultObj = quartzService.timerShutdown(Long.parseLong(_id));
            //this.result = resultObj.getContent();
        } catch (Exception e) {
            e.printStackTrace();
            r = "error:操作失败：" + e.getLocalizedMessage();
            resultObj.fault(r);
        }
        //return "jsonResult";
        return resultObj;
    }


    /**
     * 重启工作任务
     *
     * @return
     */
    @RequestMapping(value = "/templateAjax_timerRestart")
    @ResponseBody
    public Result timerRestart(String _id) {
        Result resultObj = new Result();
        String r;
        try {
            resultObj = quartzService.timerRestart(Long.parseLong(_id));
            //r = resultObj.getContent();
        } catch (Exception e) {
            e.printStackTrace();
            r = "error:操作失败：" + e.getLocalizedMessage();
            resultObj.fault(r);
        }
        //return "jsonResult";
        return resultObj;

    }

    /*

     */
/**
 * 通过OptionId 查找 option hidden column
 * 动态隐藏一些无关操作的列；如：选择‘表名直接拼接SQL模板’时，隐藏一些无关的操作属性
 * 以‘_access’结尾的方法名，在权限系统中不做验证，直接执行
 * @return
 *//*

	@RequestMapping(value = "/templateAjax_queryOptionHidColByOptionId_access")
	@ResponseBody
	public Result queryOptionHidColByOptionId_access(String optionId,
                                                     HttpServletRequest request, HttpServletResponse response){
		Result result = new Result();
		String r = "";
		try {
			List<A1TemplateColumnOptionHidColDto> a1TemplateColumnOptionHidColDtoList
				= templateService.queryOptionHidColByOptionId(Long.parseLong(optionId));

			for(A1TemplateColumnOptionHidColDto optionHidColDto:a1TemplateColumnOptionHidColDtoList){
				String optionHidColId = String.valueOf(optionHidColDto.getId());
				String optionHidColName = optionHidColDto.getColumName();
				Map<String, Object> joCompany = new HashMap<String, Object>();
				joCompany.put("id", optionHidColId);
				joCompany.put("text", optionHidColName);
				result.getList().add(joCompany);
			}
			result.success();
		}catch (Exception e) {
			e.printStackTrace();
			r = "error:操作失败："+e.getLocalizedMessage();
			result.fault(r);
		}
		return result;
	}
*/

    /**
     * check url 是否是有权访问的，控制页面显示用
     *
     * @return
     */
    @RequestMapping(value = "/templateAjax_authorizeUsingUrlCheck_access")
    @ResponseBody
    public String authorizeUsingUrlCheck_access(String url,
                                                HttpServletRequest request, HttpServletResponse response) {
        return "";
    }


}
